﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/AdminInfo/Views/Shared/_LayoutPage1.cshtml";
}


<div class="container-fluid larry-wrapper">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12">
            <!--头部搜索-->
            <section class="panel panel-padding">
                <form class="layui-form" action="/AdminInfo/AdminNews/NewsPage">
                    <div class="layui-form">
                        <div class="layui-inline">
                            <select name="NewTypeID">
                                <option value="all" selected="">-- 请选择 --</option>
                                @{
                                    foreach (Gtkj.CMS.Model.NewType item in ViewBag.NewTypeList)
                                    {
                                        <option value="@item.ID">@item.TypeName</option>
                                    }
                                }
                            </select>
                        </div>
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <input class="layui-input" name="KeyWord" placeholder="标题 / 简介/ 作者">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <input class="layui-input start-date" name="StartDate" placeholder="开始日期">
                            </div>
                            <div class="layui-input-inline">
                                <input class="layui-input end-date" name="EndDate" placeholder="截止日期">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button lay-submit class="layui-btn" id="sub" lay-filter="search">查找</button>
                        </div>
                    </div>
                </form>
            </section>
            <!--列表-->
            <section class="panel panel-padding">
                <div class="group-button">

                    <button class="layui-btn layui-btn-small modal-iframe" data-params='{"content": "/AdminInfo/AdminNews/AddNews", "title": "添加文章","full":"true"}'>
                        <i class="iconfont">&#xe649;</i> 添加
                    </button>
                    <button class="layui-btn layui-btn-small layui-btn-danger ajax-all" data-name="checkbox" data-params='{"url": "/AdminInfo/AdminNews/NewsDel","data":"","confirm":"true"}'>
                        <i class="iconfont">&#xe626;</i> 删除
                    </button>
                </div>
                <div id="list" class="layui-form"></div>
                <div class="text-right" id="page"></div>
            </section>
        </div>
    </div>
</div>
<script>
    layui.use('list');
</script>
<script id="list-tpl" type="text/html" data-params='{"url":"/AdminInfo/AdminNews/NewsPage","pageid":"#page","dataName":"data","tableWidth":"2200px"}'>
    <table id="example" class="layui-table lay-even" lay-even="" data-name="articleData" data-tplid="list-tpl">
        <thead>
            <tr>
                <th width="30"><input type="checkbox" id="checkall" data-name="checkbox" lay-filter="check" lay-skin="primary"></th>
                <th>序号</th>
                <th>主图</th>
                <th>
                    创建时间
                    <div class="order-box">
                        <a href="javascript:;" class="sort" data-filed="CreateTime" data-order="asc"><i class="iconfont">&#xe615;</i></a>
                        <a href="javascript:;" class="sort down" data-filed="CreateTime" data-order="desc"><i class="iconfont">&#xe647;</i></a>
                    </div>
                </th>
                <th>标题</th>
                <th>来源</th>
                <th>阅读量</th>
                <th>排名（越大排名越靠前）</th>
                <th>所属分类</th>

                <th>是否置顶首页</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {{# layui.each(d.list, function(index, item){ }}
            <tr>
                <td><input type="checkbox" name="checkbox" value="{{ item.NewId}}" lay-skin="primary"></td>
                <td>{{ index+1 }}</td>
                <td><img src="{{ item.Image }}" width="70" height="70" /> </td>
                <td>{{ item.CreateTime }}</td>
                <td>{{ item.Title }}</td>
                <td>{{ item.Source }}</td>
                <td>
                    <input type="text" onkeydown=" if (!(event.keyCode == 46) && !(event.keyCode == 8) && !(event.keyCode == 37) && !(event.keyCode == 39))
     if (!((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 96 && event.keyCode <= 105)))
         event.returnValue = false;" maxlength="7" class="layui-input ajax-blur" name="order" value="{{ item.Reading}}" data-params='{"url":"/AdminInfo/AdminNews/ReadingUp","data":"ID={{item.NewId}}"}'>
                <td>
                    <input type="text" onkeydown=" if (!(event.keyCode == 46) && !(event.keyCode == 8) && !(event.keyCode == 37) && !(event.keyCode == 39))
     if (!((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 96 && event.keyCode <= 105)))
         event.returnValue = false;" maxlength="7" class="layui-input ajax-blur" name="order" value="{{ item.Sorting}}" data-params='{"url":"/AdminInfo/AdminNews/SortingUp","data":"ID={{item.NewId}}"}'>
                </td>
                <td>{{ item.TypeName }}</td>

                <td>{{ item.IsTop}}</td>
                <td>
                    <button class="layui-btn layui-btn-mini modal-iframe" data-params='{"content": "/AdminInfo/AdminNews/AddNews?ID={{item.NewId}}", "title": "{{item.Title}}","full":"true"}'>
                        <i class="iconfont">&#xe653;</i>查看新闻
                    </button>
                    <button class="layui-btn layui-btn-mini layui-btn ajax" data-list='{"key":"id={{ item.NewId}}","msg":true,"render":"true","action":"del"}' data-params='{"url": "/AdminInfo/AdminNews/TopUp","data":"ID={{ item.NewId}}&name=ni","confirm":"true"}'>
                        <i class="iconfont">&#xe653;</i>{{ item.IsTopName }}
                    </button>
                    <button class="layui-btn layui-btn-mini layui-btn-danger ajax" data-list='{"key":"id={{ item.NewId}}","msg":true,"render":"true","action":"del"}' data-params='{"url": "/AdminInfo/AdminNews/NewsDel","data":"checkbox={{ item.NewId}}&name=ni","confirm":"true"}'>
                        <i class="iconfont">&#xe653;</i>删除
                    </button>
                </td>
            </tr>
            {{# }); }}
        </tbody>
    </table>
</script>



